/*
inventory_item_use();
*/
var inventory_item_type;
inventory_item_type = -1;

if (ds_list_find_value(global.inventory_current_id[0],argument0) != 0)
{
    if (ds_list_find_value(global.inventory_current_id[2],argument0) > 0)
    {
        if (global.inventory == false)
        {
            character_target = self.id;
            item_use(ds_list_find_value(global.inventory_current_id[0],argument0));
            inventory_item_type = 2;
        }
    }
    else
    {
        
        character_target = global.team_member_current_id;
        item_use(ds_list_find_value(global.inventory_current_id[0],argument0));
        inventory_item_type = 1;
    }
}

if (inventory_item_type > 0)
{
    character_item_counter = (ds_grid_get(global.item, 5, ds_list_find_value(global.inventory_current_id[0],argument0)));
    if (ds_list_find_value(global.inventory_current_id[inventory_item_type],argument0) > 1)
    {
        ds_list_sum(global.inventory_current_id[inventory_item_type], argument0, -1);
    }
    else
    {
        if ((global.team_member_current_id).character_item_equipped == argument0)
        {
            (global.team_member_current_id).character_item_equipped = -1;
        }
        ds_list_delete(global.inventory_current_id[0],argument0);
        ds_list_delete(global.inventory_current_id[1],argument0);
        ds_list_delete(global.inventory_current_id[2],argument0);
    }
}
